﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VueEntities;
using VueIRepository;
using VueModel;

namespace VueRepository
{
    public class LoginRepository : ILoginRepository
    {
        private VueDbContext _db;
        public LoginRepository(VueDbContext db)
        {
            _db = db;
        }

        public string Login(LoginModel model)
        {
            
            var user = _db.User.FirstOrDefault(s => s.Email == model.Email && s.Password == model.Password);
            if (user != null)
            {
                return "登录成功！";
            }
            else
            {
                return "登录失败！";
            }
        }
    }
}
